草庐IT

php setcookie 与 Zend_Http_Cookie

全部标签

c# - 如何删除 CookieContainer 中 1 个域下的 cookie

在System.Net.CookieContainer中如果我想删除某个域名下的所有cookies,怎么办? 最佳答案 你可以这样做。CookieContainerc=newCookieContainer();varcookies=c.GetCookies(newUri("http://www.google.com"));foreach(Cookiecoincookies){co.Expires=DateTime.Now.Subtract(TimeSpan.FromDays(1));}这将使您指定域的所有cookie过期。

c# - 如何在 Web API 授权属性中获取请求 cookie?

在.NET中有两个AuthorizeAttribute类。一个在System.Web.Http命名空间中定义:namespaceSystem.Web.Http{//Summary://Specifiestheauthorizationfilterthatverifiestherequest'sSystem.Security.Principal.IPrincipal.[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method,Inherited=true,AllowMultiple=true)]publicclassAut

c# - Asp.net 身份过期 session Cookie

我们正在使用MVC5.2和ASP.NETIdentity使用表单例份验证屏幕(用户和密码组合)进行身份验证的框架,并且使用cookie保留身份。我在身份框架的启动方法中进行了配置,将身份验证cookie的到期时间设置为30天,当用户选择“记住我”(IsPersistent=true)时,这很好用。当IsPersistent=false(用户选择不选择“记住我”)时,默认创建sessioncookie。此sessioncookie在InternetExplorer和FireFox中运行良好,当浏览器关闭时,cookie将丢失。在Chrome和Safari(可能还有其他浏览器)中,有一些选

c# - AngularJS 与 Asp.net Web API : $http post returning XMLHttpRequest cannot load: Response for preflight has invalid HTTP status code 405

当尝试使用$http将jsonPOST到Asp.netwebAPI服务器时,它返回以下错误XMLHttpRequestcannotloadhttp://localhost:62158/api/video/add.ResponseforpreflighthasinvalidHTTPstatuscode405但是从$.ajax发出相同的请求是工作文件。$HTTP代码$http.post(url,data,config).success(function(data,status,headers,config){defered.resolve(data);}).error(function(d

c# - 如何为 RabbitMQ 管理 HTTP API 生成 password_hash

心爱的人RabbitMQManagementPlugin有一个HTTPAPI通过纯HTTP请求管理RabbitMQ。我们需要以编程方式创建用户,而HTTPAPI是我们选择的方式。文档很少,但API非常简单直观。考虑到安全性,我们不想以纯文本形式传递用户密码,API提供了一个字段来发送密码哈希值。从那里引用:[GET|PUT|DELETE]/api/users/nameAnindividualuser.ToPUTauser,youwillneedabodylookingsomethinglikethis:{"password":"secret","tags":"administrator

c# - ASP.NET Core 2.0 预览版 1 : How to set up Cookie Authentication with custom login path

在ASP.NETCore2.0中,.UseAuthentication()中间件有一个重大更改,不再允许oldsyntaxmentionedhere去工作。新版本似乎在addAuthentication中处理配置,但我无法在任何地方找到任何关于如何更改指定自定义登录和注销url的旧代码的详细信息。services.AddAuthentication(o=>{//WherecanIspecifythis?????varopt=newCookieAuthenticationOptions(){LoginPath="/api/login",LogoutPath="/api/logout",}

c# - 如何在 CefSharp 中保存 cookie

我是CefSharp的新手。上周我在C#中使用CefSharp构建了我的第一个小程序。这是一个分屏程序。在一次拆分中,我加载了Tweetdeck。它工作正常,但Tweetdeck不存储cookie。每次启动程序时,我都必须登录。有没有办法保存cookies?varbrowser1=newCefSharp.WinForms.ChromiumWebBrowser("https://tweetdeck.twitter.com/"){Dock=DockStyle.Fill,};splitContainer1.Panel1.Controls.Add(browser1);

c# - RestSharp - 如何获取数字 http 响应代码?

我正在使用RestSharpC#的HTTP客户端库。我如何检索实际的数字http响应代码?我不仅没有看到包含数字代码的属性,而且我什至没有在标题集合中看到它。 最佳答案 只需从RestResponse中获取StatusCode属性对象并将枚举值转换为int。RestResponseresponse=client.Execute(request);HttpStatusCodestatusCode=response.StatusCode;intnumericStatusCode=(int)statusCode;

c# - 在 C# 中发出和接收 HTTP 请求

我想让我的C#应用程序能够发送http请求并在运行时接收答案我想请求的网站的解释是HERE我以前没有这方面的经验,所以我对JSON、XML的东西有点困惑我知道我需要一个XML解析器或类似的东西来理解请求 最佳答案 如果您不想自定义它,发出HTTP请求非常简单:一个方法调用WebClient.DownloadString.例如:varclient=newWebClient();stringhtml=client.DownloadString("http://www.google.com");Console.WriteLine(html

C# HTTP Web 请求一直超时

我正在向我可以正常访问的可用站点发出HttpWeb请求,但HTTPWeb请求总是超时。有什么理由可以说明这段代码允许它在不应该超时的情况下超时吗?我已经尝试提高超时设置,但它仍然继续超时。UriCameraUrl=newUri("http://"+cfg_cameraIps[i]);HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(CameraUrl);myRequest.Timeout=5000;myRequest.Method="HEAD";try{HttpWebResponsewebresponse;webresp